package com.waypolice.pojo;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;

public class UpmsUser implements Serializable{
    private Integer userId;

    private String username;

    private String password;

    private String salt;

    private String realname;

    private String avatar;

    private String phone;

    private String email;

    private Short sex;

    private Short locked;

    private Long ctime;

    private String str1;

    private String str2;

    private String str3;

    private String str4;

    private String str5;

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname == null ? null : realname.trim();
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar == null ? null : avatar.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email == null ? null : email.trim();
    }

    public Short getSex() {
        return sex;
    }

    public void setSex(Short sex) {
        this.sex = sex;
    }

    public Short getLocked() {
        return locked;
    }

    public void setLocked(Short locked) {
        this.locked = locked;
    }

    public Long getCtime() {
        return ctime;
    }

    public void setCtime(Long ctime) {
        this.ctime = ctime;
    }

    public String getStr1() {
        return str1;
    }

    public void setStr1(String str1) {
        this.str1 = str1 == null ? null : str1.trim();
    }

    public String getStr2() {
        return str2;
    }

    public void setStr2(String str2) {
        this.str2 = str2 == null ? null : str2.trim();
    }

    public String getStr3() {
        return str3;
    }

    public void setStr3(String str3) {
        this.str3 = str3 == null ? null : str3.trim();
    }

    public String getStr4() {
        return str4;
    }

    public void setStr4(String str4) {
        this.str4 = str4 == null ? null : str4.trim();
    }

    public String getStr5() {
        return str5;
    }

    public void setStr5(String str5) {
        this.str5 = str5 == null ? null : str5.trim();
    }

    @Override
    public String toString() {
        return "UpmsUser [userId=" + userId + ", username=" + username + ", password=" + password + ", salt=" + salt
                + ", realname=" + realname + ", avatar=" + avatar + ", phone=" + phone + ", email=" + email + ", sex="
                + sex + ", locked=" + locked + ", ctime=" + ctime + ", str1=" + str1 + ", str2=" + str2 + ", str3="
                + str3 + ", str4=" + str4 + ", str5=" + str5 + "]";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}

        if (o == null || getClass() != o.getClass()) {return false;}

        UpmsUser upmsUser = (UpmsUser) o;

        return new EqualsBuilder()
                .append(userId, upmsUser.userId)
                .append(username, upmsUser.username)
                .append(password, upmsUser.password)
                .append(salt, upmsUser.salt)
                .append(realname, upmsUser.realname)
                .append(avatar, upmsUser.avatar)
                .append(phone, upmsUser.phone)
                .append(email, upmsUser.email)
                .append(sex, upmsUser.sex)
                .append(locked, upmsUser.locked)
                .append(ctime, upmsUser.ctime)
                .append(str1, upmsUser.str1)
                .append(str2, upmsUser.str2)
                .append(str3, upmsUser.str3)
                .append(str4, upmsUser.str4)
                .append(str5, upmsUser.str5)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(userId)
                .append(username)
                .append(password)
                .append(salt)
                .append(realname)
                .append(avatar)
                .append(phone)
                .append(email)
                .append(sex)
                .append(locked)
                .append(ctime)
                .append(str1)
                .append(str2)
                .append(str3)
                .append(str4)
                .append(str5)
                .toHashCode();
    }
}